//
//  MainViewController.swift
//  xinlangweibo
//
//  Created by 陈志强 on 15/11/8.
//  Copyright © 2015年 陈志强. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        let mainTabBar = MainTabBar()
        setValue(mainTabBar, forKey: "tabBar")
        addChildViewControllers()
        
    }

    private func addChildViewControllers(){
        addChildViewController(HomeTableViewController(), title: "首页", imageName: "tabbar_home")
        addChildViewController(MessageTableViewController(), title: "消息", imageName: "tabbar_message_center")
        addChildViewController(DiscoverTableViewController(), title: "发现", imageName: "tabbar_discover")
        addChildViewController(ProfileTableViewController(), title: "消息", imageName: "tabbar_profile")
        
    }
    private func addChildViewController(vc:UIViewController,title:String,imageName:String) {
        let nav = UINavigationController(rootViewController: vc)
        
        vc.title = title;
        vc.tabBarItem.image = UIImage(named: imageName);
        addChildViewController(nav)
        
    }

}
